package com.hxzy.jsp.entity;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashSet;
import java.util.Set;

public class User {
	/** 系统管理员角色 */
	public static final int SYSADMIN = 0;
	/** 普通用户 */
	public static final int USER = 1;

	private long id;
	private String username;
	private String nickname;
	private String passwd;
	private long gmtLogin;
	int role;
	private String salt;
	private String email;
	private String hash;
	private long gmtHashExpires;
	private String ipReg;
	private String ipLogin;
	private int status;
	private long gmtCreate;
	private long gmtModified;
	private String headImg;
	private Post post;
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	public Post getPost() {
		return post;
	}
	public void setPost(Post post) {
		this.post = post;
	}
	public User(){
		
	}
	public String getSalt() {
		return salt;
	}

	public void setSalt(String salt) {
		this.salt = salt;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getHash() {
		return hash;
	}

	public void setHash(String hash) {
		this.hash = hash;
	}

	public long getGmtHashExpires() {
		return gmtHashExpires;
	}

	public void setGmtHashExpires(long gmtHashExpires) {
		this.gmtHashExpires = gmtHashExpires;
	}

	public String getIpReg() {
		return ipReg;
	}

	public void setIpReg(String ipReg) {
		this.ipReg = ipReg;
	}

	public String getIpLogin() {
		return ipLogin;
	}

	public void setIpLogin(String ipLogin) {
		this.ipLogin = ipLogin;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public long getGmtCreate() {
		return gmtCreate;
	}

	public void setGmtCreate(long gmtCreate) {
		this.gmtCreate = gmtCreate;
	}

	public long getGmtModified() {
		return gmtModified;
	}

	public void setGmtModified(long gmtModified) {
		this.gmtModified = gmtModified;
	}

	public String getHeadImg() {
		return headImg;
	}

	public void setHeadImg(String headImg) {
		this.headImg = headImg;
	}

	public static int getSysadmin() {
		return SYSADMIN;
	}

	public static int getUser() {
		return USER;
	}


	public void setUsername(String username) {
		this.username = username;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	public void setPasswd(String passwd) {
		this.passwd = passwd;
	}

	public void setGmtLogin(long gmtLogin) {
		this.gmtLogin = gmtLogin;
	}

	public void setRole(int role) {
		this.role = role;
	}

	public User(long id, String username, String nickname, String passwd, long gmtLogin, int role) {
		this.id = id;
		this.username = username;
		this.nickname = nickname;
		this.passwd = passwd;
		this.gmtLogin = gmtLogin;
		this.role = role;
	}


	public String getPasswd() {
		return passwd;
	}

	public String getUsername() {
		return username;
	}

	public long getGmtLogin() {
		return gmtLogin;
	}

	public String getGmtLoginStr() {
		Calendar calendar = Calendar.getInstance();
		calendar.setTimeInMillis(this.gmtLogin);
		return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(calendar.getTime());
	}


	public String getNickname() {
		return nickname;
	}

}
